-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make from_file and other laser init compatible #1157
Make from_file and other laser init compatible #1157
Conversation
Co-authored-by: AlexanderSinn <[email protected]> Co-authored-by: MaxThevenet <[email protected]>
Co-authored-by: AlexanderSinn <[email protected]> Co-authored-by: MaxThevenet <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR! See comments below.
docs/source/run/parameters.rst
Outdated
@@ -912,17 +912,17 @@ Option: ``gaussian`` | |||
|
|||
Option: ``from_file`` | |||
|
|||
* ``lasers.input_file`` (`string`) optional (default `""`) | |||
* ``<laser name>.input_file`` (`string`) (default `""`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's still optional, isn't it?
src/laser/Laser.H
Outdated
|
||
class Laser | ||
{ | ||
public: | ||
|
||
Laser (std::string name); | ||
/** \brief Read in a laser from an openPMD file */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you document the argument laser_geom_3D
? You'll find plenty of examples in the rest of the code how to do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the comment. The argument is documented in the file
Co-authored-by: Maxence Thévenet <[email protected]>
Co-authored-by: Maxence Thévenet <[email protected]>
Co-authored-by: Maxence Thévenet <[email protected]>
Co-authored-by: Maxence Thévenet <[email protected]>
Co-authored-by: Maxence Thévenet <[email protected]>
Co-authored-by: Alexander Sinn <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks for this PR!
@@ -871,70 +871,60 @@ Parameters starting with ``lasers.`` apply to all laser pulses, parameters start | |||
Whether to use the most stable discretization for the envelope solver. | |||
|
|||
* ``<laser name>.init_type`` (list of `string`) optional (default `gaussian`) | |||
The initializing method of laser. Possible options are: | |||
The initialisation method of laser. Possible options are: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consistency. We use US English.
The initialisation method of laser. Possible options are: | |
The initialization method of laser. Possible options are: |
|
||
* ``gaussian``(default) the laser is iniliatized with an ideal gaussian pulse. | ||
Option: ``gaussian`` (default) the laser is initialised with an ideal gaussian pulse. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Option: ``gaussian`` (default) the laser is initialised with an ideal gaussian pulse. | |
Option: ``gaussian`` (default) the laser is initialized with an ideal gaussian pulse. |
PR Description
This code enhances laser generation by supporting multiple methods of laser initialization, including
gaussian
,parser
, andfrom_file
. Lasers are instantiated via the Laser class and sequentially added to theMultilaser
instancem_multilaser
.However, previously, the methods for reading lasers from an openPMD file—specifically,
void GetEnvelopeFromFileHelper()
andvoid GetEnvelopeFromFile()
—were directly defined in the Multilaser class. As a result, when these methods were activated, no additional Laser instances could be added tom_multilaser
, leading to an incompatibility betweenfrom_file
and the other methods (gaussian
andparser
).Issue addressed
This pull request resolves the conflict by refactoring the code. It moves the member variables and functions related to reading laser data from a file, including:
from
Multilaser
class toLaser
class. With this change, the laser data can be loaded via the Laser class and then added tom_multilaser
, just like with the other initialization methods.Benefits
Together with PR #1122 and PR #866, this update allows the code to initialize multiple lasers using any combination of
parser
,gaussian
, andfrom_file
methods.The default initialization option for<laser_name>.init_type
is now gaussian, with additional options being parser and from_file.Important Note
Currently, all lasers must share the same central wavelength. If the
lasers.lambda0
of a laser does not match the wavelength loaded from the file, the code will raise an error.Test
This PR is tested through the input script:
From_file_input.txt
And three lasers respectively from different methods are generated.